import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home/Home'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name:'home',
    component: Home,
  },
  {
    path: "/device_query/:id",
    name: "device_query",
    component: () => import('../views/Query/DQuery')
  },
  {
    path: '/device',
    name:'device',
    component: () => import(/* webpackChunkName: "about" */ '../views/Device.vue')
  },
  {
    path: '/user',
    name:'user',
    component: () => import('../views/User/User')
  },
  {
    path: '/case',
    name: 'case',
    component: () => import('../views/Case/case')
  },
  {
    path: '/detail',
    name: 'detail',
    component: () => import('../views/Detail/detail')
  },
  {
    path: '/detail1',
    name: 'detail1',
    component: () => import('../views/Detail/detail2')
  },
  {
    path: '/detail2',
    name: 'detail2',
    component: () => import('../views/Detail/detail3')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/login')
  },
  {
    path: '/cause/:id',
    name: 'cause',
    component: () => import('../views/Detail/cause')
  },
  {
    path: '/tree/:id',
    name: 'Tree',
    component: () => import('../views/tree')
  },
  {
    path: '/add',
    name: 'Add',
    component: () => import('../views/Add/add')
  },
  {
    path: "/add_back",
    name: "AddBack",
    component: () => import('../views/Add/AddBack')
  },
  {
    path: "/baike",
    name: "baike",
    component: () => import('../views/Baike/baike2')
  },
  {
    path: '/product/:id',
    name: 'product',
    component: () => import('../views/Baike/ProductPage')
  },
  {
    path: '/graph',
    name: 'Graph',
    component: () => import('../views/Graph/graph'),
    children: [
      {
        path: "/graph/2dView",
        name: "2dView",
        component: () => import('../views/Graph/2dView')
      },
      {
        path: '/graph/3dView',
        name: '3dView',
        component: () => import('../views/Graph/3dView')
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
